/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.infoweblogic.dao;

import br.com.infoweblogic.interfaces.IDisciplinaDao;
import br.com.infoweblogic.interfaces.ITurmaDao;
import br.com.infoweblogic.interfaces.ITurmaDisciplinaDao;
import br.com.infoweblogic.pojos.Disciplina;
import br.com.infoweblogic.pojos.Turma;
import br.com.infoweblogic.pojos.TurmaDisciplina;
import br.com.pbs.dao.GenericDao;
import br.com.pbs.exeptions.BancoExeption;

/**
 *
 * @author Luiz Segundo
 */
public class TurmaDisciplinaDao extends GenericDao<TurmaDisciplina> implements ITurmaDisciplinaDao {

        public TurmaDisciplina verifica(TurmaDisciplina valida) throws BancoExeption {
                ITurmaDao tumDao = new TurmaDao();
                IDisciplinaDao disciplinaDao = new DisciplinaDao();
                if (valida != null) {
                        Turma t = tumDao.buscaObjetoPorNome(valida.getTurma().getNome(), new Turma());
                        Disciplina d = disciplinaDao.buscaObjetoPorNome(valida.getDisciplina().getNome(), new Disciplina());
                        return valida;
                } else {
                        throw new BancoExeption("Impossivel salva valores");
                }
        }
}
